package ru.papergames.web.npc;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import ru.common.hibernate.HibernateActionExecutor;

/**
 * Date: 13.05.12 18:50
 *
 * @author Alexander Troshanin
 */
public class NpcsManagerFactoryBean implements FactoryBean, InitializingBean, DisposableBean {

    private HibernateActionExecutor hiber;

    public void setHiber(HibernateActionExecutor hiber) {
        this.hiber = hiber;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        NpcsManager.getInstance().init(hiber);
    }

    @Override
    public Object getObject() throws Exception {
        return NpcsManager.getInstance();
    }

    @Override
    public Class getObjectType() {
        return NpcsManager.class;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    @Override
    public void destroy() throws Exception {
    }
}
